import prompt from '@system.prompt';
import router from '@system.router';
export default {
    data: {
        //下拉刷新标示
        fresh:false,
        courses1:[{
                      src: "/common/images/荣耀王者.png", name: "荣耀王者", book: '3章/852章',state:'已完结'
                  }, {
                      src: "/common/images/荣耀巅峰.png", name: "荣耀巅峰", book: '已读完',state:'已完结'
                  }, {
                      src: "/common/images/三体.png", name: "三体", book: '未读',state:'已完结'
                  },{
                      src: "/common/images/荣耀王者.png", name: "天骄战绩", book: '103章/1000章',state:'未完结'
                  },{
                      src: "/common/images/荣耀巅峰.png", name: "都市古仙医", book: '506章/1000章',state:'未完结'
                  },{
                      src: "/common/images/荣耀王者.png", name: "荣耀王者", book: '3章/852章',state:'已完结'
                  },{
                      src: "/common/images/荣耀巅峰.png", name: "荣耀巅峰", book: '已读完',state:'已完结'
                  }],
        courses2:[{
                      src: "/common/images/荣耀王者.png", name: "荣耀王者", book: '3章/852章',state:'已完结'
                  }, {
                      src: "/common/images/荣耀巅峰.png", name: "荣耀巅峰", book: '已读完',state:'已完结'
                  }, {
                      src: "/common/images/三体.png", name: "三体", book: '未读',state:'已完结'
                  }],
        backupCourses:[]
    },
    onInit(){
        this.backupCourses = JSON.parse(JSON.stringify(this.courses1));
    },
    //下拉刷新
    refresh:function(e){
        prompt.showToast({
            message:'刷新中...'
        })
        var that = this;
        that.fresh =e.refreshing;
        setTimeout(function(){
            that.fresh =false;
            that.courses1 = that.backupCourses;
            prompt.showToast({
                message:'刷新完成！'
            })
        },2000)
    },
    //    scrollbottom(e){
    //        this.loadmore =true;
    //        setTimeout(()=>{
    //            const data = this.courses.slice(0,2);
    //            this.courses = this.courses.concat(data);
    //            this.loadmore =false;
    //            prompt.showToast({
    //                message:'加载完成！'
    //            })
    //        },2000)
    //    },
    clickone(name){
        prompt.showToast({
            message:name
        })
    },
    tabChange(e){
        console.info("Tab index: " + e.index)
    },
    getchaps(){
        router.push({
            uri:"pages/novelchap/novelchap"
        })
    }
}
